import java.lang.reflect.Array;

/**
 * Created with Intellij IDEA.
 * Description:
 * User:Lenovo
 * Date:2024-12-08
 * Time:9:05
 */
class MyArray<T>{
    T[] arr;

    public MyArray() {

    }
    public MyArray(Class<T> clazz, int capacity) {
        arr = (T[]) Array.newInstance(clazz, capacity);
    }
    public void setvalue(int index, T value){
        arr[index] = value;
    }

    public T getvalue(int index) {
        return arr[index];
    }
}
public class Text {
    public static void main(String[] args) {
        Integer i = 6;
        MyArray<Integer> myArray2 = new MyArray<>(Integer.class,10);
        MyArray<Integer> myArray = new MyArray<>();
        myArray.setvalue(0,10);
        myArray.setvalue(1,"Hello");
        String a = myArray.getvalue(1);
        int b = myArray.getvalue(0);

    }
}
